import matplotlib.pyplot as plt
import basic_func.general_func as bf
    
# 绘制图形
def bar_plot():
    bf.zh_font(params)
    fig,ax = plt.subplots(layout = 'constrained')
    rect = ax.bar(df.index,height = 'Value',
                  data = df,
                  color = bf.color_selector(df,params),
                  width = params['bar_width'],
                  edgecolor = params['edge_color'],
                  lw = params['edge_lw'])
    if params['show_number'] == True:
        ax.bar_label(rect,padding = 3)
    bf.title_and_axis_setting(df,params)
    plt.show()
    
if __name__=='__main__':
    df,params = bf.read_data('test_data/简单柱状图.xlsx')
    bar_plot()
    
